<template>
  <el-form :model="tableCost">
    <el-col
      :span="14"
      class="el-col-offset-2"
    ><el-input-number
      v-model="tableCost.val"
      :controls="false"
      :precision="2"
      clearable
    /></el-col>
  </el-form>
</template>

<script>
export default {
  name: 'CommodityCostValue',
  props: {
    index: {
      type: Number,
      required: true
    },
    tablePrice: {
      type: Number,
      required: false,
      default: function() {
        return 0
      }
    }
  },
  data() {
    return {
      tableCost: {
        val: ''
      }
    }
  },
  mounted() {
    if (this.tablePrice) {
      this.tableCost.val = this.tablePrice
    }
  },
  methods: {
    getData() {
      const vm = this
      return vm.tableCost.val
    }
  }
}
</script>

<style scoped>
</style>
